{template "header.html"}
{template "index-fanhui.html"}

<script src="{THEME_PATH}assets/js/admin.js" type="text/javascript"></script>

<div class="d-clear"></div>
<form class="" role="form" id="myform">
<div class="d-container ">
	<div class="d-row">
		<div class="d-col-md-8-juzhong">
			<div class="d-kuan d-beijing-baise d-yuanjiao-10" >
				<div class="d-neikuang-20 ">
					<form class="form-horizontal" role="form" id="myform">
					    {$form}
						<input type="hidden" name="data[quanid]" value="{$_GET['cid']}">
					    <div class="portlet bordered light myfbody">
					        <div class="portlet-title">
					            <div class="caption">
					                <span class="caption-subject font-green">
					                    {dr_lang('生成卡密')}
					                </span>
					            </div>
					            <!--div class="actions">
					                <div class="btn-group">
					                    <a class="btn" href="{$reply_url}"> <i class="fa fa-mail-reply"></i> {dr_lang('返回')}</a>
					                </div>
					            </div-->
					        </div>
					        <div class="portlet-body">
					
					                <div class="form-group">
					                    <label class="col-md-12 ">{dr_lang('卡密类型')}</label>
					                    <div class="col-md-12">
					                        <div class="mt-radio-inline">
					                            <label class="mt-radio">
					                                <input type="radio" name="data[type]" onclick="dr_type(this.value)"  value="0"  {if !$data['type']} checked{/if}> {dr_lang('充值积分')}
					                                <span></span>
					                            </label>
					                            <label class="mt-radio">
					                                <input type="radio" name="data[type]" onclick="dr_type(this.value)"  value="1"  {if $data['type']} checked{/if}> {dr_lang('开通会员')}
					                                <span></span>
					                            </label>
					                        </div>
					                    </div>
					                </div>
					
					                <div class="form-group" id="dr_row_okgroup">
					                    <label class="col-md-12">{dr_lang('可用会员')}</label>
					                    <div class="col-xs-12">
					                        <div class="mt-radio-inline">
												<label class="mt-checkbox mt-checkbox-outline"><input type="checkbox" class="form-control" name="data[okgroup][]" value="0">注册用户 <span></span> </label>
					                            {$grouplist}
					                        </div>
					                    </div>
					                </div>
					                
					                <div class="form-group" id="dr_row_upgroup">
					                    <label class="col-md-12 ">{dr_lang('升级会员')}</label>
					                    <div class="col-xs-12">
					                        <select class="form-control" name="data[upgroup]">
					                            {loop $groupdata $t}
					                                <option value="{$t.id}">{$t.title}</option>
					                            {/loop}
					                        </select>
					                        <span class="help-block">可用会员与升级会员之间要注意逻辑关系！</span>
					                    </div>
					                </div>
					                <div class="form-group" id="dr_row_score">
					                    <label class="col-md-12">{dr_lang('积分')}</label>
					                    <div class="col-xs-12">
					                        <input type="text"  class="form-control" id="dr_score" name="data[score]" value="" placeholder="卡密充值的积分">
					                    </div>
					                </div>
					                <div class="form-group" id="dr_row_num">
					                    <label class="col-md-12 ">{dr_lang('数量')}</label>
					                    <div class="col-xs-12">
					                        <input type="text" class="form-control " id="dr_num" name="post[num]" value="" placeholder="本次生成卡密的数量">
					                    </div>
					                </div>
					                <div class="form-group" id="dr_row_length">
					                    <label class="col-md-12 ">{dr_lang('长度')}</label>
					                    <div class="col-xs-12">
					                        <input type="text" class="form-control " id="dr_length" name="post[length]" value="30" placeholder="卡密的长度">
					                        <span class="help-block">卡密长度建议20~50</span>
					                    </div>
					                </div>
					                <div class="form-group" id="dr_row_endtime">
					                    <label class="col-md-12 ">{dr_lang('有效期')}</label>
					                    <div class="col-xs-12 input-medium date-picker input-daterange" data-date="" data-date-format="yyyy-mm-dd">
					                        <?php echo dr_fieldform('{"name":"有效时间","fieldname":"endtime","ismain":"1","fieldtype":"Date","setting":{"option":{"format2":"0","is_left":"1","value":"","width":"100%","color":"","css":""},"validate":{"required":"0","pattern":"","errortips":"","check":"","filter":"","formattr":"","tips":""}},"ismember":"1"}', $post[endtime], 1, 1);?>
					                    </div>
					                </div>
					            </div>
					        </div>
					    </div>
					    <div class="portlet-body form myfooter">
					        <div class="form-actions text-center">
					            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}', 'myform', '2000')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('点击生成')}</button>
					        </div>
					    </div>
					</form>
					{php $erjibiao = '1_app_kami';}
					{table table=$erjibiao quanid=$_GET['id'] order=id_desc num=100 return=t}
					    <div class="d-kuan d-neikuang-10">
					    	<div class="d-hanggao-30 d-kuan {if $t['uid']==0}d-beijing-hei-d9{/if} d-xia-10 d-yuanjiao-10 pull-left">
					    		<span class="d-zuo-10" {if $t['uid']!=0}style="color:#ef6f1a" {/if}>{$t.id} - {$t['kami']}   {if $t['uid']==0}（待使用）{else}已使用 <i class="bi bi-check-circle"></i> {/if}</span>
					    	 <br>
							 <span class="d-zuo-10">到期 {dr_date($t.endtime, 'Y-m-d')}</span>
							 <br>
							 
							 <span class="d-zuo-10">由 <span style="color:#ef6f1a;" ></span> 
								 <span style="color:#3ca2ef" >
									<?php $arr=dr_string2array($t.okgroup);?>
									     {loop $arr $b}
									     <span class="badge badge-color-{$b}">{php echo Phpcmf\Service::M('my', 'kami')->getgroupname($b);}</span>
									{/loop}
									
								 </span> 
							 </span>
							 
							 {if $t.type==0}{if $t.score} <span class="d-zuo-10 badge badge-info">充值{$t.score}{SITE_SCORE}</span>{/if}{else}<span class="d-zuo-10 badge badge-danger">升级 {php echo Phpcmf\Service::M('my', 'kami')->getgroupname($t.upgroup);} </span>{/if}
							<br>
							{if $t['uid']!=0}
							<span class="d-zuo-10 ">使用用户：{php $user=dr_member_info($t['uid']);}{$user['username']}</span> 
							<span class="d-zuo-10 ">使用时间：{dr_date($t.usedtime, 'Y-m-d')}</span> 
							{/if}
							</div>
							
							
							
					    	
					    </div>
					    <div class="d-clear"></div>
						
					{/table}
					<div class="d-clear"></div>
					
					
					
				</div>
				<div class="d-neikuang-20 ">
					
				</div>
			</div>
		</div>
	</div>
</div>
</form>

{template "fanhui.html"}

{template "footer.html"}